package com.ccys.doctor.controller;

import com.ccys.common.vo.ResponseResultApp;
import com.ccys.db.dto.doctor.consult.CreateOrUpdateConsultNoteDto;
import com.ccys.db.vo.doctor.consultNote.GetConsultNoteVo;
import com.ccys.doctor.service.ConsultNoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: WhiteCoat
 * @description: 咨询相关接口
 * @author: ZhangJingCan
 * @create: 2024-02-05 15:18
 **/

@RestController
@Api(tags = "咨询备忘录接口")
@RequestMapping("consultNote")
public class ConsultNoteController {

    @Autowired
    private ConsultNoteService consultService;

    /**
     * 触发时机：创建咨询后备注时
     * todo 经过测试，对方前端传入的字段：file_name_new 为文件名，并且使用|分割，这个文件名带后缀，比如：11.txt|22.jpg
     * todo 需要后续确认是否这样
     *
     * @param dto
     * @return
     */
    @ApiOperation("创建或更新咨询备忘录")
    @PostMapping(value = "/CreateOrUpdateConsultNote")
    public ResponseResultApp createOrUpdateConsultNote(@RequestBody CreateOrUpdateConsultNoteDto dto) {
        return consultService.createOrUpdateConsultNote(dto);
    }

    /**
     * 触发时机：结束问诊之后的历史问诊中选择某次问诊，下方的删除
     *
     * @param id
     * @return
     */
    @ApiOperation("删除咨询备忘录")
    @DeleteMapping(value = "/DeleteConsultNote")
    public ResponseResultApp deleteConsultNote(String id) {
        return consultService.deleteConsultNote(id);
    }

    @ApiOperation("获取过去的预订记录")
    @DeleteMapping(value = "/GetConsultNote")
    public ResponseResultApp<GetConsultNoteVo> getConsultNote(String booking_id) {
        return consultService.getConsultNote(booking_id);
    }

}
